<?php
/**
 * Gold Cmage Module
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Gold
 * @package     Gold_Cmage
 * @copyright   Copyright (c) 2011 Gold
 * @Author $Id$
*/

/**
 * Product in category grid
 *
 * @category   Gold
 * @package    Gold_Cmage
 */
class Gold_Cmage_Block_Adminhtml_Catalog_Category_Tab_Product extends Mage_Adminhtml_Block_Catalog_Category_Tab_Product
{

	protected $_showAllRecords       = false;
	public function __construct()
    {
    	$this->_showAllRecords = true;
        parent::__construct();
    }
    
    protected function _prepareColumns()
    {        
        $this->addColumnAfter('image', array(
            'header'    => Mage::helper('catalog')->__('Image'),
            'index'     => 'image',
        	'filter'	=> false,
            'sortable'	=> false,
        	'align'		=> 'center',
            'renderer'	=> 'Gold_Cmage_Block_Adminhtml_Widget_Grid_Column_Renderer_Image'
        ), 'entity_id');
        
        $this->addColumnAfter('action',
            array(
                'header'    => Mage::helper('catalog')->__('Action'),
                'width'     => '50px',
                'type'      => 'action',
                'getter'     => 'getId',
                'actions'   => array(
                    array(
                        'caption' => Mage::helper('catalog')->__('Edit'),
                        'url'     => array(
                            'base'=>'*/catalog_product/edit',
                            'params'=>array('store'=>$this->getRequest()->getParam('store'))
                        ),
                        'field'   => 'id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
        ), 'position');

        return parent::_prepareColumns();
    }

    public function getRecordCount()
    {
    	if ($this->_showAllRecords)
    	{
    		return $this->getCollection()->getSize();
    	}
    	
    	return false;
    }

}